<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>个人信息</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="80px">
                    <el-form-item label="用户名">
                        <el-input v-model="form.accountId" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="姓名">
                        <el-input v-model="form.userName"></el-input>
                    </el-form-item>
                    <el-form-item label="所属部门">
                        <el-input v-model="form.department" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="手机号">
                        <el-input v-model="form.mobileNo"></el-input>
                    </el-form-item>
                    <el-form-item label="密码">
                        <a href="javascript:void(0);" @click="modifyPassword=true" v-if="!modifyPassword">修改密码</a>
                        <a href="javascript:void(0);" @click="modifyPassword=false" v-if="modifyPassword">取消修改</a>
                    </el-form-item>
                    <el-form-item label="新密码" v-if="modifyPassword">
                        <el-input type="password" v-model="newPassword"></el-input>
                    </el-form-item>
                    <el-form-item label="再输一次" v-if="modifyPassword">
                        <el-input type="password" v-model="confirmedNewPassword"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">确定</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>

    </div>
</template>

<script>
    import util from '../common/util';
    export default {
        name: 'baseform',
        data: function(){
            return {
                form: {
                    acountId: '',
                    userName: '',
                    department: '',
                    mobileNo: ''
                },
                modifyPassword:false,
                newPassword:'',
                confirmedNewPassword:''
            }
        },
        mounted(){
            util.restful('get','account/'+util.getAccountId(),null,(account)=>{
                this.form = account;
            });
        },
        methods: {
            onSubmit() {
                this.$message.success('提交成功！');
            }
        }
    }
</script>
